import request from '@/utils/request'

/**查询所有启用的部门 */
export function getOfficeAll(data) {
  return request({
    url: '/admin/office/listALL',
    method: 'get'
  })
}

export function getOfficeList(data) {
  return request({
    url: '/admin/office/findList',
    method: 'get',
    params: data
  })
}
/** 修改/添加时弹出树 */
export function getOfficeTree(data) {
  return request({
    url: '/admin/office/treeData?extId=' + data.extId,
    method: 'get'
  })
}

export function getOffice(id) {
  return request({
    url: '/admin/office/' + id,
    method: 'get'
  })
}

export function updateOffice(data) {
  return request({
    url: '/admin/office',
    method: 'put',
    data
  })
}

/**
 * 保存部门
 * @param {部门} data
 */
export function saveOffice(data) {
  return request({
    url: '/admin/office',
    method: 'post',
    data
  })
}

/**
 *  删除部门
 * @param {id} id
 */
export function delOffice(id) {
  return request({
    url: '/admin/office/' + id,
    method: 'delete'
  })
}
